package com.dragon.app.IO;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class FileCopy {

	public static void main(String[] args) {
		
		Long beginT = new Long(System.currentTimeMillis());
		
		
		
		File src = new File("D:\\03娱乐\\音乐","童话镇.mp3");
		File des = new File("C:\\Users\\SmallDragon\\Desktop\\新建文件夹","童话镇copy.mp3");
		InputStream fis = null;
		OutputStream fos = null;
		try {
			fis = new FileInputStream(src);
			fos = new FileOutputStream(des);
			byte [] temp = new byte[1024];
			int len = -1;
			while((len =fis.read(temp)) != -1) {
				fos.write(temp, 0, len);
			}
			fos.flush();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}finally {
			try {
				fos.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
			try {
				fis.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
		
		Long endT = new Long(System.currentTimeMillis());
		System.out.println(endT-beginT);
	}

}
